-
Notifications
You must be signed in to change notification settings - Fork 60
Make compatible with pyserial, add some examples as well for computer usage #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…w example for computer/linux logging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! See comments.
adafruit_gps.py
Outdated
data_type, args = sentence | ||
data_type = data_type.upper() | ||
if data_type == 'GPGGA': # GGA, 3d location fix | ||
data_type = bytes(data_type.upper(), "utf-8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using "ascii"
here and below as the encoding? In CircuitPython this arg is ignored (you can say "foobar"
), but in regular Python it has to be an encoding name. If pyserial is reading junk with chars >128, then it will throw an error:
>>> bytes('ab\xbb', 'ascii')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xbb' in position 2: ordinal not in range(128)
>>> bytes('ab\xbb', 'utf-8')
b'ab\xc2\xbb'
>>>
adafruit_gps.py
Outdated
self._uart.write('\r\n') | ||
checksum ^= char | ||
self._uart.write(b'*') | ||
self._uart.write(bytes('{:02x}'.format(checksum).upper(), "utf-8")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"utf-8"
-> "ascii"
, per previous comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yah im into it. lemme do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okee dokee!
Updating https://github.com/adafruit/Adafruit_CircuitPython_Fingerp to 1.1.1 from 1.1.0: > Merge pull request adafruit/Adafruit_CircuitPython_Fingerp#9 from ladyada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_FXAS21002C to 1.2.0 from 1.1.0: > fix context typo > make sure they get a recent version of busdevice with i2c write-then-read support > fix wrong reference & pylint > use single call for i2c transactions, to support linux Updating https://github.com/adafruit/Adafruit_CircuitPython_FXOS8700 to 1.2.0 from 1.1.0: > Merge pull request adafruit/Adafruit_CircuitPython_FXOS8700#9 from ladyada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_GPS to 3.1.1 from 3.1.0: > Merge pull request adafruit/Adafruit_CircuitPython_GPS#8 from ladyada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_MMA8451 to 1.2.0 from 1.1.0: > Merge pull request adafruit/Adafruit_CircuitPython_MMA8451#3 from ladyada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_BusDevice to 2.2.5 from 2.2.4: > Merge pull request adafruit/Adafruit_CircuitPython_BusDevice#21 from ladyada/master
Moving Bill's changes to my repo
mostly turning everything into bytes instead of using strings